/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;

import controll.Mapping;

/**
 * 
 * @author phuc
 */
public class Ghe implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long gheID;
	private String soGhe;
	private List<BangGia> bangGiaList;
	private Toa toaID;
	private LoaiGhe loaiGheID;
	private List<ChiTietHoaDon> chiTietHoaDonList;
	private Mapping map = map = new Mapping();

	public Ghe() {
	}

	public Ghe(Long gheID) {
		this.gheID = gheID;
	}

	public Ghe(Long gheID, String soGhe) {
		this.gheID = gheID;
		this.soGhe = soGhe;
	}

	public Long getGheID() {
		return gheID;
	}

	public void setGheID(Long gheID) {
		this.gheID = gheID;
	}

	public String getSoGhe() {
		return soGhe;
	}

	public void setSoGhe(String soGhe) {
		this.soGhe = soGhe;
	}

	/**
	 * Get list bang gia theo ghe
	 * @return
	 */
	public List<BangGia> getBangGiaList() {
    	return map.getBangGiaList(this);
	}

	public Toa getToaID() {
		return toaID;
	}

	public void setToaID(Toa toaID) {
		this.toaID = toaID;
	}

	public LoaiGhe getLoaiGheID() {
		return loaiGheID;
	}

	public void setLoaiGheID(LoaiGhe loaiGheID) {
		this.loaiGheID = loaiGheID;
	}

	public List<ChiTietHoaDon> getChiTietHoaDonList() {
		map = new Mapping();
    	return map.getChiTietHoaDonList(this);
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (gheID != null ? gheID.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Ghe)) {
			return false;
		}
		Ghe other = (Ghe) object;
		if ((this.gheID == null && other.gheID != null)
				|| (this.gheID != null && !this.gheID.equals(other.gheID))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "entity.Ghe[ gheID=" + gheID + " ]";
	}

	public Ghe getGheByGheID(long gheID) {
		return map.getGheByGheID(gheID);
	}

}
